#include<iostream>
#define Maxsize 100
using namespace std;
int Queue[Maxsize];
int front=0;
int rear=0;
void Init();
bool isFull();
void Push(int n);
int Getlength();
int Pop();
int main()
{
  int n;
  cin>>n;
  for(int i=0;i<n;i++){
    int t;
    cin>>t;
    Push(t);
  }
  for(int i=0;i<2;i++){
    Pop();
  }
  Push(11);
  Push(12);
  int len=Getlength();
  for(int i=0;i<len;i++){
    if(i){
      cout<<' '<<Pop();
    }else cout<<Pop();
  }
  return 0;
}
void Init()
{
  for(int i=0;i<Maxsize;i++){
    Queue[i]=0;
  }
}
void Push(int n)
{
  if(!isFull()){
    Queue[rear]=n;
    rear=(rear+1)%Maxsize;
  }
}
bool isFull()
{
  if(front==(rear+1)%Maxsize){
    return true;
  }else return false;
}
int Pop()
{
  int temp=Queue[front];
  front=(front+1)%Maxsize;
  return temp;
}
int Getlength()
{
  return (rear-front)%Maxsize;
}
